/**
 * 登录模块，提供登录相关业务功能
 * 
 * @Date: 2015-6-16
 * @author: Jackson wang
 * @version: 1.0
 * @since: 1.0
 */
define(["jquery", "msgServ","datagridServ","uploadifive","btnServ","uploadify","sysmanMain","commonServ"],
		function($, msgServ,datagridServ, uploadifive,btnServ,uploadify,sysmanMain,commonServ) {

			'use strict';
			var _buttonConfig,_defaultConfig,_moduleConfig,_bizProto,
				moduleCode = 'uploadfiles',
				uploadurl='/upload/uploadifive.action',
				delurl='/upload/del.action',
				uploadPageurl='/upload/query/uploadfivePage.action',
				uploadListurl = '/upload/query/getInitListDomain.action',
				param,
				windowid = 'win-upload-file',
				_buttonConfig,
				biztableid,
				rootid = 'sysman-uploadfiles',
				_size = {width:700,height:500},
				uploadifyInitialized,
				_initParam ,
				
				//供应商文档配置信息
				supplyArchiveConfig,
				
				//map类型供应商配置信息
				supplyArchiveConfigMap
				
			//附件预览html
			var _archivePreviewHtml = '<th>附件</th>'+
									  '<td style="width:674px">'+
										'<div id="archive" name="archive"></div>'+
									  '</td>';
			//附件上传删除html
			var _archiveUploadHtml = '<th"></th>'+
						'<td style="width:674px">'+
						'<input id="file_upload" name="file_upload" type="file" multiple="true">'+
						'<div id="queue"></div>'+
						'</td>'+
						_archivePreviewHtml;
			var public_method = {				
				/**
			     * 初始化附件组件
			     * 
			     * @param _options.rootid		dom根节点id
			     * @param _options.containerid	附件容器dom节点id
			     * @param _options.bizcode		业务编码
			     * @param _options.bizno		记录id
			     * @param _options.queueComplete	成功回调函数
			     * @param _options.uploadComplete	成功回调函数
			     * @param _options.error		失败回调函数
			     */
			    initUpload:function(_options){
					
			    	var _ac = $('#'+_options.rootid + ' #'+_options.containerid)
			    	if(_ac.length<=0){
			    		return ;
			    	}
			    	
			    	var _default = {
			    		bizcode		  : null,
			    		bizno		  : null,
			    		rootid		  : null,
			    		queueComplete : null,
			    		uploadComplete: null,
			    		del			  : true
			    	}
			    	
			    	$.extend(_default,_options);
			    	_ac.empty();
			    	_ac.append(_archiveUploadHtml);
			    	
					var _data = {bizcode:_default.bizcode,bizno:_default.bizno};;
					
					//初始化上传附件组件
					public_method.init({
						data:_data,							
						queue_id: _default.rootid + ' #queue',
						file_id : _default.rootid + ' #file_upload',
						rootPath: '/'+sysmanMain.getRootPath(),
						rootid  : _default.rootid,
						auto    : true,
						removeCompleted : true ,
						queueComplete : function(file,data){
							var _param = {
								file	: file,
								data	: data,
								bizcode : _default.bizcode,
								rootid  : _default.rootid
							}
							if(_default.queueComplete){
								_default.queueComplete(_param)
							}else{
								var _id =$('#'+_default.rootid + ' #id').val()
								if(_id){ _default.bizno=_id	}
								
								public_method.initArchive(_default);
								msgServ.Msgslide('文件上传成功');
							}
						},
						uploadComplete: function(file,data,response){
							var _param = {
								file	: file,
								data	: data, 
								response: response,
								bizcode : _default.bizcode,
								rootid  : _default.rootid,
								del		: true
							}
							if(_default.uploadComplete){
								private_method.uploadComplete(_param);
							}else{
								var _id =$('#'+_default.rootid + ' #id').val()
								if(_id){ _default.bizno=_id	}
								
								public_method.initArchive(_default);
								msgServ.Msgslide('文件上传成功');
							}
						}
						
					});	
					public_method.initArchive(_options);
				}
				,
				/**
				  * 初始化附件信息
				 * @param _options.bizcode	业务编码
				 * @param _options.bizno	业务记录id
				 * @param _options.rootid	dom根节点
				 * @param _options.del		是否允许删除
				 * @param _options.isAudit	是否启用审核
				 */
				initArchive:function(_options){
					
					var _default = {
						bizcode : null,
						bizno   : null,
						rootid  : null,
						del     : false,
						isAudit : false	//是否启用审核
					}
					//参数获取
					$.extend(_default,_options);
					
					//定位附件
					var _el = $('#' + _default.rootid + ' #archive');
					
					if(_el.length>0){
						_el.empty();
						/**
						 * 根据审核状态判断是否显示按钮栏
						 */
						var showToolBar = true
						
						
//						//判断审核标志
//						if(_default.isAudit){
//							if(buttonEvent.checkAuditStatus({editWindow:rootid})){
//								showToolBar = false
//							}	
//						}			
						
						var _data = {bizcode:_default.bizcode,bizno:_default.bizno};
						
						var _param = {
							url:'/'+sysmanMain.getRootPath()+uploadListurl,
							data:{condition:_data},
							type: 'post',
							success:function(data){
								if(window.console){
									console.log(' archive init ...')
								}
								var _html ='';
								if(data && data.rows){
									_html = '<ul>'
									$.each(data.rows,function(i,o){
										if(o.filename){
											_html += '<li><span>'+o.filename+'</span>'
											         
											var _name = o.filename.split('.');
											if(_name.length>0){
												var _extname = _name[_name.length-1];
												var _type = '';
												switch(_extname){
													case 'doc':
														_type = _extname;
														break;
													case 'docx':
														_type = _extname;
														break;
		//												case 'xls':
		//													_type = _extname;
		//													break;
		//												case 'xlsx':
		//													_type = _extname;
		//													break;
													default:
														
												}
											}
											
											if(_type){
												_html += '<a class="archive-preview archive-btn" btn-type="preview" aid="'+o.id+'" >'+'        预览' +'</span></a>';
												
											}
											
											_html += '<a class="archive-info archive-btn" btn-type="download" aid="'+o.id+'">'+'        下载'+'</a>' 
											
											if(_options && _options.del){
												_html += '<a class="archive-remove archive-btn" btn-type="remove" aid="'+o.id+'"><span style="color:red">'+'        删除' +'</span></a>' 
											}
											
											_html +='</li>';	
										}
									})
									
									_html +='</ul>'
								}
								
								
								_el.append(_html);
								
								//绑定下载点击事件
								var file_btn = $('#'+_default.rootid + ' .archive-info')
								if(file_btn.length>0){
									file_btn.unbind('click')
									file_btn.bind('click',	private_method.downloadfileByEvent)
								}
								
								//绑定预览点击事件
								var file_btn = $('#'+_default.rootid + ' .archive-preview')
								if(file_btn.length>0){
									file_btn.unbind('click')
									file_btn.bind('click',	private_method.previewFile)
								}
								
								//绑定下载点击事件
								var file_btn = $('#'+_default.rootid + ' .archive-remove')
								if(file_btn.length>0){
									file_btn.unbind('click')
									file_btn.bind('click',	
										function(e){
											private_method.removeFile({
												rootid	: _default.rootid,
												bizcode : _default.bizcode,
												bizno	: _default.bizno,
												evt		: e
											})
										}
									)
								}
								
							}
						}
						
						$.ajax(_param);
					}
				}
				,
				initDoc:function(_options){
					
					 
					if(window.console){
						console.info(' upload module loaded and starting...')
					}
					var _param = {file_id :windowid +' #file_upload',queue_id:windowid +' #queue'}
					_param =$.extend({},param,_param)
					//按钮设置
					_buttonConfig={
						 
						 "取消":private_method.cancel	,
						 "上传":private_method.upload
					}
					_param.tableid = rootid + ' div.table-archive'
//					public_method.initList(_param)
					private_method.init(_param);
				},
				
				//初始化图片查看
				/**
				 * 附件查看初始化
				 * @param _options.data
				 * @param _options.rootid
				 * @param _options.rootPath
				 * @param _options.edit_window_id				 
				 */
				imgShow:function(_options){
					var _defaultConfig = {
						width:800,
						height:600
					}
					
					_initParam = {
						data:_options.data,
						imageView:true,
						rootPath:_options.rootPath,
						rootid:_options.rootid
					}
					
					_defaultConfig = $.extend({},_defaultConfig,_options)
					
					var _url = _options.rootPath +'/upload/query/imageShowPage.action'
					var _window = '#'+windowid
					var _param = {
						href:_url,
						width:_defaultConfig.width,
						height:_defaultConfig.height
					}
				
					
					_param.onClose=public_method.closeWindow({window_id:windowid})
					
					$(_window).window(_param)
					$(_window).window('vcenter').window('hcenter')
					
					$(_window).window('open')
					
				},
				
				closeWindow:function(_options){
					if(_options.window_id){
						var _window = $('#'+_options.window_id)
						if(_window.length==1){
							$(_window).empty();
						}
					}
				},
				
				/**
				 * 初始化附件列表页面
				 * @param _options.data
				 * @param _options.tableid		附件列表dom对象id
				 * @param _options.rootPath
				 * @param _options.toolbarid
				 * @param _options.imageView	显示图片查看列
				 * @param _options.showToolBar  是否显示工具栏
				 */
				initList:function(_options){
					var _config = {
						showToolBar:true
					}
					
					_options= $.extend({},_config,_options)
					if(_options ){						
						
						
						var map = {
							   	'supply-undefined':'请选择类别',
							   	'supply-businesslicence': '营业执照' ,
							   	'supply-authorizecertification':'法人授权书',
							   	'supply-socialsecurity':'社保证明',
							   	'supply-education':'被授权人培训证',
						        'supply-nobriberecord' : '无行贿记录证明',
							   	'supply-aftersaleservice':'售后服务承诺书',
							   	'supply-honestcontract':'廉洁购销合同'
							   //	'supply-badinfomation' : '不良记录'
						}
						
						//获取后台配置信息
						if(!supplyArchiveConfigMap){
							var _config = private_method.getSupplyArchiveConfigMap();
							
							if(_config){
								supplyArchiveConfigMap = _config;								
							}
						}
						
						//判断是否覆盖默认配置信息
						if(supplyArchiveConfigMap){
							map = supplyArchiveConfigMap;
						}
						
						if(!_options.data){
							_options = $.extend({},_options,_initParam)
						}
						if(! _options.data){
							msgServ.Msgslide('系统参数异常，请刷新页面联系系统管理员')
							return 
						}
						var _columns = [[
								{field:'ck',checkbox:true},
								{field:'filename',title:'文件名称',width:100,halign:'center'},        
								{field:'filetype',title:'文件类型',width:50,halign:'center'},        
								{field:'filesize',title:'文件大小',width:50,halign:'center'} ,
								{field:'filedownload',title:'操作',width:50,align:'center',
									formatter:function(value,row,index){
										return  '<span><font color=blue>下载</font></span>';
									}
								}
							]]

						//判断是否是供应商管理界面
						if (_options.isSupplyEditPage) {
							_columns = [[
								{field:'ck',checkbox:true},
								{field:'filename',title:'文件名称',width:100,halign:'center', 
									formatter:function(value, row, index) {
										if (!row.id && row.filename) {
											return '<span><font color="red">' + row.filename + '</font></span>';
										}
										return '<span><font>' + row.filename + '</font></span>';
									}
								},        
								{field:'filetype',title:'文件类型',width:50,halign:'center', 
									formatter:function(value, row, index) {
										if (!row.id && row.filename) {
											return '<span><font color="red">暂未上传</font></span>';
										}
										return '<span><font>' + row.filetype + '</font></span>';
									}
								},        
							//	{field:'filesize',title:'文件大小',width:50,halign:'center'},
								{field:'bizcode', title:'附件类别', width:100, halign:'center',
								   	formatter:function(value, row, index) {
                               		
										if (!row.id && row.filename) {
											return '<span><font color="red">暂未上传</font></span>';
										}

								   		if (row.id) {
									   	    var result = '<select name="selectname' + row.id + '" id="selectid' +  row.id + '">';

									   		if (row.bizcode === 'supply-undefined') {
									   			console.info('come in');			  
									   			for (var key in map) {
									   				result += '<option value="' + key + '" >' + map[key] + '</option>';
									   			}
									   		}
									   		else {
									   			for (var key in map) {
									   				if (row.bizcode === key) {
									   					result += '<option value="' + key + '">' + map[key] + '</option>';
									   					break;
									   				}
									   			}
									   			for (var key in map) {
									   				if (row.bizcode != key && key != 'supply-undefined') {
									   					result += '<option value="' + key + '">' + map[key] + '</option>';
									   				}
									   			}
									   		}
									   		result += '</select>';
											return result;
										}
 								   	}
								},
								{field:'filedownload',title:'操作',width:50,align:'center',

									formatter:function(value,row,index){
										if (row.id) {
											return  '<span><font color=blue>下载</font></span>';
										}
									}
								}
							]]
						}
						if(_options.imageView){
							_columns = [[
								{field:'ck',checkbox:true},
								{field:'filename',title:'文件名称',width:100,halign:'center'},        
								{field:'filetype',title:'文件类型',width:50,halign:'center'},        
								{field:'filesize',title:'文件大小',width:50,halign:'center'} ,
								{field:'imgview',title:'操作',width:50,align:'center',
									formatter:function(value,row,index){
										return  '<span><font color=blue>查看</font></span>';
									}
								},
								{field:'filedownload',title:'操作',width:50,align:'center',
									formatter:function(value,row,index){
										return  '<span><font color=red>下载</font></span>';
									}
								}
							]]
						}

						var _param = {
							title:'附件列表',
							url:_options.rootPath + uploadListurl,
							queryParams:{condition:_options.data},
							rownumbers:true,
							fitColumns: true,
							pagination:true,
							idField: 'id',
							pageSize:5,
							pageList:[5],
							columns:_columns,
							
							onClickCell:function(index,field,value){
								private_method.clickCell(index,field,value,_options.rootId)
							}
						}

						//传递bizcodes 防止相同的bizno
						if (_options.isSupplyEditPage) {
							var bizcodes = '\'supply-undefined\'';
							_param.queryParams.isSupplyEditPage = true;
							for (var key in map) {
								bizcodes += (',' + '\'' + key + '\'');
							}
							_param.queryParams.bizcode_in = bizcodes;
							_param.queryParams.bizno = '\'' + _options.data.bizno + '\'';
						}

						
						if(_options.toolbarid){
							_param.toolbar = $('#' + _options.toolbarid)
						}else{
							_param.toolbar =$('#'+rootid + ' div.list-btn')
						}						
						
						if(_options.tableid ){
							var _table = $('#'+ _options.tableid)
							$('#'+ _options.tableid).datagrid(_param)
						}
						
						if(_options.biztableid){
							biztableid = _options.biztableid
							var _biztable = $('#'+ _options.biztableid)
							$('#'+ _options.biztableid).datagrid(_param)
						}
					}
				},
				init:function(_options){
					private_method.init(_options)
				},
				
				/**
				 * 执行文件上传
				 * @param _options.id
				 * @param _options.bizcode
				 * @param _options.rootPath
				 * @param _options.width
				 * @param _options.height
				 * @param _options.biztableid
				 */
				upload:function(_options){
					private_method.upload(_options);
//					_options =$.extend(_size,_options)
//					param=_options
//					var _param = {
//						window:$('#' +windowid),
//						href:_options.rootPath+uploadPageurl,
//						width:_options.width,
//						height:_options.height,
//						flag:false,
//						existCheckElement:'#'+rootid}
//					datagridServ.windowEdit(_param);	
				},
				
				/**
				 * @param _options.biztableid
				 */
				del:function(_options){
					
					var $bizgrid= $('#'+_options.biztableid)					
					
					if($bizgrid.length>0){
						datagridServ.delRow({
							url:_options.rootPath + delurl,
							target:$bizgrid});
					}					
					
				}
				
			}

			var private_method = {
				/**
				 * 文件上传初始化
				 * @param _options.file_id			文件id
				 * @param _options.queue_id			队列id
				 * @param _options.data				需提交的form数据
				 * @param _options.rootPath			根路径
				 * @param _options.buttonExtends	按钮扩展
				 * @param _options.auto				自动上传
				 */
				init:function(_options){

					_buttonConfig={
						 
						 "取消":private_method.cancel	,
						 "上传":private_method.upload
					}
					if(_options.buttonExtends){
						_buttonConfig = $.extend({},_buttonConfig,_options.buttonExtends)
					}
					var _param = {}
					if(	   _options.file_id 
						&& _options.queue_id 
						&& _options.data 
						&& _options.rootPath){
						
							_param ={
								'auto'             : false,								
								'queueID'          : _options.queue_id,
								'buttonClass'	   : 'btn btn-warning',
								'debug'            : true,	
								'formData'         : _options.data,
								'buttonText'       : '选择文件',
								'swf'      		   : '/css/upload/uploadify.swf',
								'onUploadError'	   :private_method.uploadErr,
								'onUploadSuccess'	:private_method.uploadSuccess,
								'onQueueComplete' : private_method.upload_success,
								'multi'			   : true
							};
						
							if(_options.auto){
								_param.auto = _options.auto
							if(_options.removeCompleted){
								_param.removeCompleted = true;	
							}
						}
						
						//上传完成后回调函数定义
						if(_options.queueComplete){
							_param.	onQueueComplete = _options.queueComplete
						}
						
						if(_options.uploadComplete){
							_param.onUploadSuccess = _options.uploadComplete
						}
						var _queue = $('#' + _options.queue_id)
						var _filel = $('#' + _options.file_id)
						if(_options.rootid)
							rootid = _options.rootid
							
						if(_options.fileType){
							_param.fileType=_options.fileType
						}
						if(!$.support.leadingWhitespace){
							_param.uploader = _options.rootPath +uploadurl
							$('#' +_options.file_id ).uploadify(_param)
						}else{
							_param.uploadScript =_options.rootPath +uploadurl
							$('#' +_options.file_id ).uploadifive(_param)
						}
//						
					}
				},
				
				upload_success:function(file,data){
					if(window.console)
						console.log(data);
					private_method.reloadGrid();
					msgServ.Msgslide('文件上传成功')
				},
				
				uploadSuccess:function(file,data,response){
					msgServ.Msgslide('文件上传成功')
				},
				/**
				 * @param _options.file_id
				 * @param _options.queue_id
				 * @param _options.rootid
				 */
				upload:function(_options){
					
					var _uploadElement 
					if(!_options || !_options.rootid){
						_uploadElement = $('#'+rootid + ' #file_upload')
					}else{
						_uploadElement = $('#' + _options.rootid)
					}
					if(_uploadElement && _uploadElement.length>0){

						if(window.FormData !==undefined){
							$(_uploadElement ).uploadifive('upload')
						}else{
							$(_uploadElement ).uploadify('upload')							
						}
					}else{
						msgServ.Msgslide('系统异常，请联系系统管理员进行。。。')
					}
						
				},
				//绑定按钮事件
				bindBtnEvent:function(){					
					
					var file_btn = $('#' +rootid+' a.file_upload_btn')
					$(file_btn).unbind('click')
					$(file_btn).bind('click',	private_method.function_btn_listenner)
					
				},	
				
				//功能按钮监听函数
				function_btn_listenner:function(e){					
					btnServ.applyButton({buttonEvt:e,buttonConfig:_buttonConfig})					
				},
				
				//
				cancel : function() {
					$('#'+windowid).window('close');
				},
				
				reloadGrid:function(){
					
					var $bizgrid= $('#'+biztableid)
					
					
					if($bizgrid.length>0){
						$bizgrid.datagrid('reload')
					}
				},
				uploadErr:function(file,errorCode,errorMsg,errorString){
					msgServ.Msgslide('upload error。。。')
				}
				,clickCell:function(index,field,value,rootid){
					if(window.console)
						console.info(' clickCell fired ...')
					


					var $bizgrid= $('#'+biztableid)
					var record = $($bizgrid).datagrid('getRows')[index];
					
					if(field=='filedownload' ){						
						var _url = '/'+sysmanMain.getRootPath() +'/upload/downloadFileTest.action'
												
						if(record && record.id){
							private_method.downloadfile(record.id)						
						}						
					}
					
					if(field=='imgview' ){						
						var _url = '/portal/getImage.action'
						var imgEl = $('#'+rootid + ' #archive-img')	
						
						if(record && record.id && imgEl.length==1){
							_url =_url +'?id='+ record.id;	
							$(imgEl).attr('src',_url)
						}						
					}


					//更新供应商管理界面的文件类别
					if (field == 'bizcode') {
						
						var sortedids = {
								'supply-businesslicence' : '1',
								'supply-authorizecertification' : '2',
								'supply-socialsecurity' : '3',
								'supply-education' : '4',
								'supply-nobriberecord' : '5',
								'supply-aftersaleservice' : '6'
						}
						
						//获取配置信息
						if(!supplyArchiveConfig){
							var _config = private_method.getSupplyArchiveConfig()
							
							supplyArchiveConfig = _config;	
							
						}
						
						
						//如果存在配置信息，迭代生成排序对象，覆盖默认定义的排序字段
						if(supplyArchiveConfig){							
							sortedids = {}
							$.each(supplyArchiveConfig,function(i,o){
								if(o.sortedid){
									sortedids[o.typecode]=o.sortedid
								}
							})
						}
						supplyArchiveConfig = sortedids;
						
						
						console.info('field bizocde test');	
						var $selectid = '#selectid' + record.id;
						$($selectid).change(function(){
							console.info('field bizocde changed');	
							record.bizcode =  $(this).val();
							if (record.bizcode) {
								record.sortedid = sortedids[record.bizcode];
								private_method.updateBizcode(record)
							//	private_method.reloadGrid();
							}
						})
					}	
				},

				//更新供应商管理界面文件类别
				updateBizcode:function(_data) {
					var _url = '/' + sysmanMain.getRootPath() 
					+ '/upload/save.action';	

					$.ajax({
							url:_url,
							type : 'post',
							dataType:'json',
							data:$.toJSON(_data),
							contentType:'appliction/json;charset=utf-8',						
							success:function(data){
								private_method.reloadGrid();
								msgServ.Msgslide('操作成功');
							}
						})
				},
				/**
				 * 根据按钮对象执行文件下载
				 * @param e	事件对象
				 */
				downloadfileByEvent:function(e){
					var _btn = $(e.currentTarget)
			
					var _id = _btn.attr('aid')
					
					private_method.downloadfile(_id);
				}
				,
				downloadfile:function(id){
					if(window.console){
						console.log('download file fired ')	
					}
					var _url = '/'+sysmanMain.getRootPath() +'/upload/downloadFileTest.action'
					var form = $("<form>");
					form.attr('style','display:none');
					form.attr('target','');
					form.attr('method','post');
					form.attr('action',_url);
					var input1 = $("<input>");
					input1.attr('type','hidden')
					input1.attr('name','id')
					input1.attr('value',id);
					$('body').append(form);
					$(form).append(input1);				
					form.submit();
					form.remove();
					
				},
				downloadajax:function(data,data2,data3){
					var aLink = document.createElement('a');
					var blob = new Blob([data]);
					var evt = document.createEvent('HTMLEvents');
					evt.initEvent('click',false,false);
					aLink.download = 'filename';
					aLink.href = URL.createObjectURL(blob);
					aLink.dispatchEvent(evt);
				}
				,
				//预览文件
				previewFile:function(e){
					var _btn = $(e.currentTarget)
					
					var _id = _btn.attr('aid')
					if(_id){
						var _url = '/portal/preview.action?id='+_id;
						
						window.open(_url);
					}
				}
				,
				
				/**
				 * @param _options.evt	按钮事件
				 * @param _options.bizcode	业务编码
				 * @param _options.rootid	dom根节点id
				 * @param _options.bizno	业务记录id
				 */
				removeFile:function(_options){
					var _default = {
						evt		: null,
						bizcode : null,
						rootid	: null
					}
					
					$.extend(_default,_options);
					
					if(_default.evt && _default.evt.currentTarget){
						
						var _btn = $(_default.evt.currentTarget);				
						var _id = _btn.attr('aid')				
						if(_id){
							$.messager.confirm('警告', '确定执行删除操作?', function(r){
							
								if( r){	
									var _url = '/'+sysmanMain.getRootPath() +'/upload/del.action';
									$.ajax({
										url:_url,
										data:{id:_id},
										success:function(data){
											if(data && data.status=='success'){
												public_method.initArchive({
													bizcode	: _options.bizcode,
													rootid	: _options.rootid,
													del		: true,
													bizno	: _options.bizno
												});
												msgServ.Msgslide('操作成功');
											}else{
												msgServ.Msgslide('操作异常');
											}
										}
										,
										error:function(){
											msgServ.Msgslide('操作失败');
										}
									})
								}
							})
						}
					}
					
				}
				,
				
				/**
				 * 获取供应商资质配置信息
				 */
				getSupplyArchiveConfig:function(){
					var _url = '/'+sysmanMain.getRootPath() +'/upload/query/getSupplyArchiveConfig.action',retVal			
			        	
			        $.ajax({
			        	url:_url,
			        	type:'post',			        	
			        	async:false,
			        	success:function(data){
			        			        			
			        			retVal = data
			        		
			        	}
			        })
			        return retVal			
				}
				
,
				
				/**
				 * 获取供应商资质配置信息map
				 */
				getSupplyArchiveConfigMap:function(){
					var _url = '/'+sysmanMain.getRootPath() +'/upload/query/getSupplyArchiveConfigMap.action',retVal			
			        	
			        $.ajax({
			        	url:_url,
			        	type:'post',			        	
			        	async:false,
			        	success:function(data){
			        		        			
			        			retVal = data
			        		
			        	}
			        })
			        return retVal			
				}

			};
			
			return public_method;

		});